package main

import (
	"runtime"
	"sync"
)

var (
	count int32
	wag   sync.WaitGroup
)

//func main() {
//	wag.Add(2)
//	go incCount()
//	go incCount()
//	wag.Wait()
//	fmt.Println(count)
//}

func incCount() {
	defer wag.Done()
	for i := 0; i < 2; i++ {
		value := count
		//暂停线程，切到队列中
		runtime.Gosched()
		value++
		count = value
	}
}
